package cn.northsea.controller;
import cn.northsea.common.Result;
import cn.northsea.entity.RentChat;
import cn.northsea.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//历史数据回显
@RequestMapping("/chat")
@RestController
@CrossOrigin
public class WebSocketController {

    @Autowired
    private ChatService chatService;

    @GetMapping("/chatList")
    @ResponseBody
    public Result chatList(String username){
        List<RentChat> rentChats =  chatService.queryChatList(username);
        return Result.success(rentChats);
    }

}
